home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / sane-utils.postinst < prev    next >
Encoding:
Text File  |  2010-12-12  |  1.6 KB  |  65 lines

  1. #!/bin/sh
  2. set -e
  3. . /usr/share/debconf/confmodule
  4.  
  5. SANED_DEFAULT=/etc/default/saned
  6.  
  7. saned_eh () {
  8.     echo "saned couldn't start; check your inetd configuration and README.Debian"
  9. }
  10.  
  11. if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ]; then
  12.     db_get sane-utils/saned_run
  13.     RUN_SANED="$RET"
  14.  
  15.     db_get sane-utils/saned_scanner_group
  16.     SANED_IN_SCANNER="$RET"
  17.  
  18.     # Add saned service, disabled by default
  19.     if [ -x /usr/sbin/update-inetd ]; then
  20.     update-inetd --add "#<off># sane-port\tstream\ttcp\tnowait\tsaned:saned\t/usr/sbin/saned saned"
  21.     fi
  22.  
  23.     # Stop debconf; output to stdout after this point. update-inetd needs debconf.
  24.     db_stop
  25.  
  26.     # Create saned user/group if they do not exist
  27.     if ! getent passwd | grep -q "^saned:"; then
  28.     echo "Adding saned group and user..."
  29.     adduser --quiet --system --no-create-home --group saned || true
  30.     fi
  31.  
  32.     if [ "$SANED_IN_SCANNER" = "true" ]; then
  33.     adduser --quiet saned scanner
  34.     else
  35.     if id saned | grep -q "groups=.*\(scanner\)"; then
  36.         deluser --quiet saned scanner
  37.     fi
  38.     fi
  39.  
  40.     if [ -e $SANED_DEFAULT ]; then
  41.     if [ "$RUN_SANED" = "true" ]; then
  42.         RUN_SANED=yes
  43.     else
  44.         RUN_SANED=no
  45.     fi
  46.  
  47.     sed -e "s/^ *RUN=.*/RUN=$RUN_SANED/" < $SANED_DEFAULT > $SANED_DEFAULT.tmp
  48.     mv -f $SANED_DEFAULT.tmp $SANED_DEFAULT
  49.     fi
  50. fi
  51.  
  52.  
  53. # Automatically added by dh_installinit
  54. if [ -x "/etc/init.d/saned" ]; then
  55.     update-rc.d saned defaults >/dev/null
  56.     if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
  57.         invoke-rc.d saned start || saned_eh
  58.     else
  59.         /etc/init.d/saned start || saned_eh
  60.     fi
  61. fi
  62. # End automatically added section
  63.  
  64.  
  65.